<script>
import { h } from 'vue'
// import { ElButton } from 'element-plus'
// import CheckBoxGroup from '../../../public/static/component/zlMenuLeft.js';
export default {
    // components: { CheckBoxGroup },
    props: {
        item: {
            type: Object,
            default: function () {
                return null
            }
        }
    },
    model: {
        prop: 'item',
        event: 'changeItem'
    },
    render() {
        let _this = this
        return h(this.componenetName ? this.componenetName : 'div', {
            item: _this.item,
            value: Object.prototype.hasOwnProperty.call(_this.item.attribute, 'modelValue') ? (_this.item.attribute.modelValue['value'] ? _this.item.attribute.modelValue['value'] : '') : Object.prototype.hasOwnProperty.call(_this.item.attribute, 'ArrayModelValue') ? (_this.item.attribute.ArrayModelValue['value'] ? _this.item.attribute.ArrayModelValue['value'] : '') : (Object.prototype.hasOwnProperty.call(_this.item.attribute, 'ObjectModelValue') ? (_this.item.attribute.ObjectModelValue['value'] ? _this.item.attribute.ObjectModelValue['value'] : '') : ''),
            'onUpdate:modelValue': ($event) => {
                Object.prototype.hasOwnProperty.call(_this.item.attribute, 'modelValue') ? (_this.item.attribute.modelValue.value = $event.value) : Object.prototype.hasOwnProperty.call(_this.item.attribute, 'ArrayModelValue') ? (_this.item.attribute.ArrayModelValue.value = $event.value) : (_this.item.attribute.ObjectModelValue.value = $event.value)
            }
        })
    },
    data() {
        return {
            componenetName: null,
            attr: {}
        }
    },
    watch: {
        item: {
            handler(v) {
                this.$forceUpdate()
            },
            deep: true
        }
    },
    created() {},
    mounted() {
		console.log('item只', JSON.parse(JSON.stringify(this.item)))
        if (this.item.useMethod === '1') {
            this.componenetName = require('../../../public/static/component/' + this.item.fileName).default['zldemo']
        } else {
            this.componenetName = require('../component-list/basic/' + this.item.fileName).default
            return
        }
        // 引用名称， 引用方式，括号或者非括号，UI库的需要，引用路径，属性
    }
}
</script>
